﻿<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>

<head>
	<meta charset="UTF-8">
	<title>文化服务</title>
	<meta name="page-view-size" content="1280*720">
	<link rel="stylesheet" href="css/base.css">
	<link rel="stylesheet" href="css/A_doubleList.css">
	<script type="text/javascript" src="lib/js/evm.js"></script>
	<script type="text/javascript" src="lib/js/Evm_djyw.js"></script>
	<script type="text/javascript" src="lib/js/key.js"></script>
	<script src="lib/js/md5.js" type="text/javascript" charset="utf-8"></script>
	<script src="lib/js/jquery-1.11.1.min.js" type="text/javascript" charset="utf-8"></script>
	<script src="lib/js/jquery.cookie.js" type="text/javascript" charset="utf-8"></script>
	<script src="js/api.js" type="text/javascript" charset="utf-8"></script>
	<script src="js/public.js" type="text/javascript" charset="utf-8"></script>

	<script src="js/model.js"></script>

</head>

<body>
	<div class="theoretical-bg" id="helpMain">

		<div id="headerTitle" class="headerTitle"></div>

		<div class="containBar">
			<div class="shareContain" id="myShareBody">
				<div class="leftBar">
					<ul class="btnsBar" id="btnsBar">
						<!-- 左侧按钮 -->
					</ul>
				</div>
				<div class="menuBar" id="menuBar">
					<ul class="menuList" id="menuContent">

					</ul>
				</div>

				<div class="rightBar" id="rightBar">
					<!-- 我的技能 -->
					<div class="rightSkill" id="rightSkill">
						<div class="skillBar" id="skill">
							<!-- 技能模块 -->
						</div>
					</div>
					<p class="pageShow"><span id="now_page">1</span>/<span id="total_page">1</span></p>
				</div>

			</div>

		</div>
		<div class="scoreBox">积分：100分</div>
	</div>
</body>

<script>
	var areaName = '';
	var modelIndex = {
		menuIndex: 0,
		disUser: false, //显示头像
		index: 0, //导航栏初始位置
		menuPageSize: 7, //导航栏模块数量
		pageSize: 1, //主模块数量
		type: '',
		// structure: 2,//上下结构  默认1是左右，2是上下结构
		menuContainerId: 'btnsBar', //包含导航栏模块的标签id
		menuListName: 'leftBtn', //导航栏模块名称class
		mainContainerId: 'skill', //包含主模块的标签id
		mainlistName: '', //主模块名称
		thisContain: 'rightListBar', //翻滚外容器
		thisDetail: 'rightList', //翻滚内容
		api: "getArticleList", //默认接口类型
		status: 1,
		category: 0,
		is_volunteer: 0,
		is_menu: 0,
		define: ''
	}
	var articleRun;
	var sourceName = TV.GetParam("model")
	var leftData = dataIndex[sourceName];
	var diyArry = [{
			id: 74,
			name: "文明单位",
			model: "Company",
			img: "images/wenming1.png"
		},
		{
			id: 75,
			name: "文明村镇",
			model: "town",
			img: "images/wenming2.png"
		},
		{
			id: 76,
			name: "文明家庭",
			model: "Family",
			img: "images/wenming3.png"
		},
		{
			id: 77,
			name: "东台好人",
			model: "goodperson",
			img: "images/wenming4.png"
		}
	]

	var activediyArry = [{
			id: 74,
			name: "本期点单",
			model: "noworderList",
			img: "images/nowdiandan.png"
		},
		{
			id: 75,
			name: "往期点单",
			model: "oldorderList",
			img: "images/olddiandan.png"
		}
	]

	var muenListData = [{
			name: '一月',
			id: '1'
		},
		{
			name: '二月',
			id: '2'
		},
		{
			name: '三月',
			id: '3'
		},

		{
			name: '四月',
			id: '4'
		},
		{
			name: '五月',
			id: '5'
		},

		{
			name: '六月',
			id: '6'
		},
		{
			name: '七月',
			id: '7'
		},
		{
			name: '八月',
			id: '8'
		},

		{
			name: '九月',
			id: '9'
		},
		{
			name: '十月',
			id: '10'
		},

		{
			name: '十一月',
			id: '11'
		},

		{
			name: '十二月',
			id: '12'
		}
	];


	function getMenus(page, number) {
		if (typeof number == 'number') {
			//				modelIndex.mainContainerId = leftData[number].list_name;
		}
		left.paint(page, number);

		// var heightpx = (500 / (leftData.length))

		// $(".leftBtn").css("height", heightpx + "px")
		// $(".leftBtn").css("line-height", (heightpx + heightpx * 0) + "px")


	}

	function getMessage(id, page, pos, index, type) { //id,类型，页码，上下页，位置
		// is_menu = false;
		detailone = false;

		{
			if (modelIndex.api == "getActivityList") {
				var params = {
					page: page,
					pagesize: modelIndex.pageSize,
					is_volunteer: modelIndex.is_volunteer,
					is_menu: modelIndex.is_menu,
				}
			} else if (modelIndex.api == "orderList") {
				var params = {
					page: page,
					pagesize: modelIndex.pageSize,
				}
			} else if (modelIndex.api == "myRecordList") {
				var params = {
					access_token: $.cookie("TV_CST_TOKEN"),
					page: page,
					pagesize: modelIndex.pageSize,
				}
			} else if (modelIndex.api == "eventList") {
				var params = {
					tpe: 1,
					page: page,
					pagesize: modelIndex.pageSize,
				}
			} else {
				var params = {
					cid: id,
					page: page,
					pagesize: modelIndex.pageSize,
					area_id: TV.GetParam('area_id'),
					device: 'tv'
				}
				if (modelIndex.api == "goodList") {
					if (EVM.cookie.getValue('TV_CST_TOKEN')) {
						var score = EVM.cookie.getValue('TV_CST_SCORE')
						$(".scoreBox").html("积分：" + score)
						$(".scoreBox").show()
					}

				}
			}
		}

		runState = true;

		if (modelIndex.mainlistName == "list-diy") { //这里是不走接口，走的定义样式
			runState = false;
			var str = '';
			for (var i = 0; i < diyArry.length; i++) {
				str += '<div class=' + modelIndex.mainlistName + ' data-id=' + diyArry[i].id + '>';
				str += '<div class="diy-content">'
				str += '<img src="' + diyArry[i].img + '">'
				str += '</div>'
				str += '</div>'
			}
			$('#' + modelIndex.mainContainerId).html(str);
			MessOpt(page, 1, pos, index, '', '');
		} else if (modelIndex.mainlistName == "list-active-diy") { //这里是不走接口，走的定义样式
			runState = false;
			var str = '';
			for (var i = 0; i < activediyArry.length; i++) {
				str += '<div class=' + modelIndex.mainlistName + ' data-id=' + activediyArry[i].id + '>';
				str += '<div class="diy-active-content">'
				str += '<img src="' + activediyArry[i].img + '">'
				str += '</div>'
				str += '</div>'
			}
			$('#' + modelIndex.mainContainerId).html(str);
			MessOpt(page, 1, pos, index, '', '');
		} else if (modelIndex.mainlistName == "rightListBar") { //这里是不走接口，走的是双列表中的详情样式
			runState = false;
			var outRule ='<p>（1）平台积分只能用于文明超市兑换礼品</p><p>（2）积分使用过程中不找零、不兑现、不开发票，不可转移至其他账户。</p><p>（3）使用积分进行兑换，兑换申请一经提交, 一律不能取消(除礼品缺货等特殊情况)。</p><p>（4）如电视平台缺货等原因导致的退货退款，则抵扣的积分将返还到电视用户账户，如因用户个人原因导致的退货退款，则不返还抵扣积分。</p><p>（5）兑换礼品请用户到有线营业厅自行办理。</p><p>（6）凤阳广网公司对礼品保留最终解释权。</p>'
			//兑换规则 id = 1
			var getRule ='<div class="exTitle">1.每日学习</div><p>每天点击资讯，浏览学习10秒以上：每日可领取积分+5</p><p>每日观看一个视频，可领取积分+5，每日上限30积分奖励</p><p>每日观看一个图文资讯，可领取积分+5，每日上限30积分奖励</p><p>每日点赞一次，可领取积分+5，每日上限20积分奖励</p><p>每报名完成一次志愿活动，可获得积分+30</p><p>每参与一次百姓点单活动，可获得积分+30</p><p>每参与一次志愿活动，可获得积分+30</p><p>每发布一次文明曝光台，可获得积分+20</p><p>每发布一次文明打卡站，可获得积分+20</p><p>每点赞一次，可获得积分+1，每日上限20分</p><div class="exTitle">2.其他操作</div><P>新用户首次登录平台：赠送30积分</P><P>首次在文明超市兑换礼品：赠送20积分</P><div class="exTitle">3.其他问题</div><P>如用户在积分积累过程、或商品兑换过程中遇到上述无法解答的情况，请联系电话进行咨询</P>'
			//获取规则 id =0

			var articleDetail = "";
			switch (parseInt(id)) {
				case 0://获取规则
					articleDetail = getRule
					break;
				case 1: //兑换规则
					articleDetail = outRule
					break;
			}
			if (id > 2) {

				GetDatas("getArticleList", params, function (err, data) {
					var articleId = data.data.items[0].id
					GetDatas("getArticle", {
						id: articleId
					}, function (err, data) {
						articleDetail = data.data.content
						var str = '';
						str += "<div class=" + modelIndex.mainlistName + " id=rightListBar >"
						str += "<div class=rightList id=rightList>"
						str += "<div>"
						str += articleDetail
						str += "</div>"
						str += "</div>"
						str += "</div>"
						$('#' + modelIndex.mainContainerId).html(str);
						MessOpt(page, 1, pos, index, '', '');

					})
				})
			} else {
				var str = '';
				str += "<div class=" + modelIndex.mainlistName + " id=rightListBar >"
				str += "<div class=rightList id=rightList>"
				str += "<div>"
				str += articleDetail
				str += "</div>"
				str += "</div>"
				str += "</div>"
				$('#' + modelIndex.mainContainerId).html(str);
				MessOpt(page, 1, pos, index, '', '');
			}




		} else {
			GetDatas(modelIndex.api, params, function (err, data) {
				if (data.code == 10002 || data.code == 401) { //貌似是提示未登录
					TV.PromptMsg("您未登录或已过期，请登陆");

					setTimeout(function () {
						window.location.href = "login.html"
					}, 3000)
				} else {
					var dataItems = [];
					for (var i = 0; i < data.data.items.length; i++) {
						var v = data.data.items[i]
						dataItems.push({
							id: (modelIndex.api == "orderList" ? v.cur_period : v.id),
							video_path: v.video_path,
							tpe: v.tpe,
							content: v.content,
							name: v.username,
							time: v.addtime || v.format_add_time || v.tpe_name,
							img: v.img ? v.img : (v.images ? v.images : v.logo),
							title: (modelIndex.api == "goodList") ? (v.name + " 所需积分： " + v.integral +
								"分") : (modelIndex.api == "myRecordList") ? (v.goodsname) : v.title,
							status: v.status || v.sts,
							score: v.integral,
							add: v.address ? v.address : v.brief,
							tag: v.tag,
							article_model: v.article_model
						})
					}

					console.log(dataItems)
					var str = '';
					if (modelIndex.mainlistName == "list-video") {
						console.log(dataItems[i])
						if (dataItems.length) {
							for (var i = 0; i < dataItems.length; i++) {
								str += '<div class=' + modelIndex.mainlistName + ' data-id=' + dataItems[i].id +
									" video_path_tv= '" + dataItems[i].video_path + "' tpe=" + dataItems[i].tpe +
									'>';
								str += '<div class="list-header">'
								str += '<img class="listPic" src="' + (dataItems[i].img ? (API_URL.imgURL +
									dataItems[i].img) : "/images/default.png") + '"> '
								if (dataItems[i].tpe == 4) {
									str += '<div class=videologo>';
									str += '<img src=images/playlogo.png>';
									str += '</div>';
								}
								str += '</div>'
								if (modelIndex.api == "getArticleList") {
									if (dataItems[i].article_model != 'people' && dataItems[i].tpe == 1) {
										str += '<div class="list-flag flag1">' + "文章" + "</div>"
									} else if (dataItems[i].tpe == 2) {
										str += '<div class="list-flag flag2">' + "图文" + "</div>"
									} else if (dataItems[i].tpe == 3) {
										str += '<div class="list-flag flag3">' + "图集" + "</div>"
									} else if (dataItems[i].tpe == 4) {
										str += '<div class="list-flag flag4">' + "视频" + "</div>"
									} else if (dataItems[i].tpe == 5) {
										str += '<div class="list-flag flag5">' + "直播" + "</div>"
									}
								}
								str += '<div class="leader-content">'
								str += '<div class="leaderName">'
								str += '<div class="dataMess">' + dataItems[i].title + '</div>'
								str += '</div>'
								str += '</div>'
								str += '</div>'
							}
							$('.pageShow').css('display', 'block');
							$('#now_page').html(page)
						} else {
							if (params.cid == 9999) {
								str += '<div class="noneData">';
								str += '<img src=images/erweima.png>';
								str += '</div>';
							} else {
								str += '<div class="noneData">';
								str += '<img src=images/no.png>';
								str += '</div>';
							}
							$('.pageShow').css('display', 'none');
						}
					} else if (modelIndex.mainlistName == "list-row") {
						if (dataItems.length) {
							for (var i = 0; i < dataItems.length; i++) {
								str += '<div class=' + modelIndex.mainlistName + ' data-id=' + dataItems[i].id +
									' status=' + dataItems[i].status + '>';

								str += (modelIndex.api == "orderList" ? "" :
									'<div class="row-header"><img class="listPic" src="' + (dataItems[i].img ?
										API_URL.imgURL + dataItems[i].img : "/images/default.png") +
									'"> </div>')
								str += '<div class="row-content">'
								str += '<div class="leaderName">'
								str += '<div class="dataMess">' + dataItems[i].title + '</div>'
								str += '</div>'
								str += '</div>'
								str += (modelIndex.api == "orderList" ? "<div class=orderButton>点单</div>" : "")
								str += '<div class="row-add">'
								str += dataItems[i].time || dataItems[i].add
								str += '</div>'

								if (modelIndex.api != "orderList") {
									str += "<div class='row-status'>" + "<img src=images/rowstatus" + dataItems[i]
										.status + ".png></div>";
								}


								str += '<div class="row-border"></div>'
								str += '</div>'
							}
							$('.pageShow').css('display', 'block')
							$('#now_page').html(page)
							$('#total_page').html(dataItems.totalpage)
						} else {
							if (params.cid == 9999) {
								str += '<div class="noneData">';
								str += '<img src=images/erweima.png>';
								str += '</div>';
							} else {
								str += '<div class="noneData">';
								str += '<img src=images/no.png>';
								str += '</div>';
							}
							$('.pageShow').css('display', 'none');
						}
					} else if (modelIndex.mainlistName == "list-line") {
						if (dataItems.length) {
							for (var i = 0; i < dataItems.length; i++) {
								str += '<div class=' + modelIndex.mainlistName + ' data-id=' + dataItems[i].id +
									' tpe=' + dataItems[i].tpe + '>';
								str += '<div class="line-content">'
								str += '<div class="leaderName">'
								str += '<div class="dataMess">' + dataItems[i].title + '</div>'
								str += '</div>'
								str += '</div>'
								// str += (modelIndex.api == "orderList" ? "<div class=orderButton>点单</div>" : "")
								if (modelIndex.api == "helpList") {
									str += "<div class='line-status'>" + "<img src=images/linestatus" + dataItems[
										i].status + ".png></div>";
								}
								str += '</div>'
							}
							$('.pageShow').css('display', 'block');
							$('#now_page').html(page)
						} else {
							if (params.cid == 9999) {
								str += '<div class="noneData">';
								str += '<img src=images/erweima.png>';
								str += '</div>';
							} else {
								str += '<div class="noneData">';
								str += '<img src=images/no.png>';
								str += '</div>';
							}
							$('.pageShow').css('display', 'none');
						}
					} else if (modelIndex.mainlistName == "list-log") {
						runState = false;
						str = "<div class=log-title>"
						str += "<div class=log_time>时间</div>"
						str += "<div class=log_sroce>积分</div>"
						str += "<div class=log_name>物品</div>"
						str += "<div class=log_status>状态</div>"
						str += "</div>"
						if (dataItems.length) {
							for (var i = 0; i < dataItems.length; i++) {
								str += "<div class='" + modelIndex.mainlistName + "' data-id=" + dataItems[i].id +
									" tpe=" + dataItems[i].tpe + ">";
								str += "<div class=log-time>" + dataItems[i].time
								str += "</div>"
								str += "<div class=log-score>" + dataItems[i].score + "</div>"
								str += "<div class=log-name>" + dataItems[i].title + "</div>"
								str += "<div class=log-status>" + (dataItems[i].status == 1 ? "未兑换" : "已领取") +
									"</div>"
								str += "</div>"
							}
							$('.pageShow').css('display', 'block');
							$('#now_page').html(page)
						} else {
							if (params.cid == 9999) {
								str += '<div class="noneData">';
								str += '<img src=images/erweima.png>';
								str += '</div>';
							} else {
								str += '<div class="noneData">';
								str += '<img src=images/no.png>';
								str += '</div>';
							}
							$('.pageShow').css('display', 'none');
						}
					} else if (modelIndex.mainlistName == "list-piece") {
						runState = false;
						if (dataItems.length) {
							for (var i = 0; i < dataItems.length; i++) {
								str += '<div class=' + modelIndex.mainlistName + ' data-id=' + dataItems[i].id +
									'>';
								str += '<div class="piece-img">'
								str += "<img src=" + (dataItems[i].img ? API_URL.imgURL + dataItems[i].img :
									"/images/nonePic.png") + ">"
								str += '</div>'
								str += '<div class="piece-content">'
								str += dataItems[i].content
								str += '</div>'
								str += '<div class="piece-name">'
								str += dataItems[i].name
								str += '</div>'
								str += '<div class="piece-time">'
								str += dataItems[i].time
								str += '</div>'
								str += '</div>'
							}
							$('.pageShow').css('display', 'block');
							$('#now_page').html(page)
						} else {
							if (params.cid == 9999) {
								str += '<div class="noneData">';
								str += '<img src=images/erweima.png>';
								str += '</div>';
							} else {
								str += '<div class="noneData">';
								str += '<img src=images/no.png>';
								str += '</div>';
							}
							$('.pageShow').css('display', 'none');
						}
					}

					$('#' + modelIndex.mainContainerId).html(str);
					MessOpt(page, data.data.totalpage, pos, index, 'run', 'dataMess');
				}
			})
		}
	}

	function direEnter(status, id, index) {
		if (modelIndex.api == "getArticleList") { //资讯列表页
			GetDatas("getArticle", {
				id: $('.active').attr('data-id')
			}, function (err, res) {
				tag = res.data.tag
				category_name = res.data.category_name
				type = parseInt($(".active")[0].getAttribute('tpe'));
				if (type == 1 || type == 2 || type == 3) {
					// window.location.href = 'detailHasPicture.html?id=' + $('.active').attr('data-id');
					if (category_name == "公益广告") {
						window.location.href = './carrousel.html?id=' + $('.active').attr('data-id') +
							'&type=getArticle';

					} else if (category_name == '东台好人' || category_name == '中国好人' || category_name == '江苏好人' ||
						category_name == '盐城好人') {
						window.location.href = 'goodPerson.html?id=' + $('.active').attr('data-id');

					} else {
						window.location.href = 'detailHasPicture.html?id=' + $('.active').attr('data-id');
					}
				} else if (type == 4 || type == 5) {
					GetDatas("getArticle", {
						id: $('.active').attr('data-id')
					}, function (err, res) {

						mediaStr = res.data.video_path_tv
						window.location.href = 'play.html?id=' + $('.active').attr('data-id') +
							"&mediaStr=" + mediaStr;

					})
				}
			})


		} else if (modelIndex.api == "getActivityList") { //活动列表页
			status = parseInt($(".active")[0].getAttribute('status'));
			window.location.href = 'B_detailActivety.html?titles=志愿活动&id=' + $('.active').attr('data-id');
		} else if (modelIndex.api == "volunteerList") { //志愿团队列表页
			window.location.href = ' A_teamGroupDetail.html?titles=志愿者团队&id=' + $('.active').attr('data-id');
		} else if (modelIndex.api == "helpList") { //自助点单列表
			window.location.href = ' selfHelpOrder.html?titles=自助点单&order_id=' + $('.active').attr('data-id');
		} else if (modelIndex.api == "goodList") { //商品列表
			GetDatas('goodRecord', {
				goods_id: $('.active').attr('data-id'),
				token: $.cookie('TV_CST_TOKEN'),
			}, function (err, res) {
				console.log(res)
				if (res.code == 0) {
					TV.PromptMsg(res.message)
				} else if (res.code == 401) {
					var message = res.message
					TV.PromptMsg(message)
					setTimeout(function () {
						window.location.href = './login.html';
					}, 2500)
				} else {
					var message = res.message
					TV.PromptMsg(message)
				}

				http(API_URL.loginURL + 'api/user/getProfile', {
					token: $.cookie('TV_CST_TOKEN')
				}, function (err, data) {
					EVM.cookie.setValue('TV_CST_SCORE', data.data.score)
					$(".scoreBox").html("积分：" + data.data.score)

				})
			})
		} else if (modelIndex.api == "diy" && diyArry[index].model != 'goodperson') { //文明创建的diy模块
			// && diyArry[index].model != 'GoodPerson'
			window.location.href = 'A_SingleList.html?model=' + diyArry[index].model + "&titles=" + diyArry[index].name;
		} else if (modelIndex.api == "diy" && diyArry[index].model == 'goodperson') {
			window.location.href = 'A-doubleList.html?model=' + diyArry[index].model + "&titles=" + diyArry[index].name;
		} else if (modelIndex.api == "active-diy") {
			window.location.href = 'A_SingleList.html?model=' + activediyArry[index].model + "&titles=" + activediyArry[
				index].name;
		} else if (modelIndex.api == "orderList") { //实践点单
			GetDatas('orderSure', {
				period_id: $('.active').attr('data-id'),
				token: $.cookie('TV_CST_TOKEN'),
			}, function (err, res) {
				console.log(res)
				if (res.code == 0) {
					TV.PromptMsg('点单成功')
				} else if (res.code == 401) {
					var message = res.message
					TV.PromptMsg(message)
					setTimeout(function () {
						window.location.href = './login.html';
					}, 2500)
				} else {
					var message = res.message
					TV.PromptMsg(message)
				}
			})
		} else if (modelIndex.api == "Detail") { //右侧详情页
			clearInterval(articleRun);
		} else if (modelIndex.api == "eventList") { //右侧详情页
			window.location.href = './carrousel.html?id=' + $('.active').attr('data-id') + '&type=event';
		} else if (modelIndex.mainlistName == "" || modelIndex.api == "myRecordList") { //我的积分兑换记录
		}  else if (modelIndex.api == "getVoteList" ) { //投票列表
			window.location.href = 'A_SingleList.html?model=getVoteDetail&titles='+dataIndex["getVoteDetail"].name+"&id="+$('.active').attr('data-id');

		} else {}
	}
</script>
<script type="text/javascript" src="js/twoPageList.js"></script>

</html>